package com.yu.CollectionTest;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;

public class NotSafeDemo {

    public static void main(String[] args) {

        ConcurrentHashMap<Object, Object> objectObjectConcurrentHashMap = new ConcurrentHashMap<>();

        List list1 = new ArrayList<>();
        //List list = new Vector();
        CopyOnWriteArrayList<String > objects = new CopyOnWriteArrayList<>();
        objects.add("a");
        List list = Collections.synchronizedList(list1);
        for (int i = 0; i <100 ; i++) {
            new Thread(()->{
                list.add(UUID.randomUUID().toString());
                System.out.println(list);
            },"线程"+i).start();
        }

    }



}
